const Sequelize = require('sequelize');
const baseModel = require('../baseModel');

class works_public extends baseModel{
  constructor(){
    super('works_public',{
      id:{
        type: Sequelize.INTEGER,
        autoIncrement: true,
        allowNull: false,
        primaryKey:true
      },
      // 学员ID
      stu_id:{
        type: Sequelize.INTEGER,
        allowNull: false,
      },
      // 机构ID
      org:{
        type: Sequelize.INTEGER,
        allowNull: false,
      },
      name:{
        type: Sequelize.STRING(20),
        allowNull: false
      },
      type:{
        type: Sequelize.STRING(6),
        allowNull: false
      },
      // // 文件地址
      // description:{
      //   type: Sequelize.STRING(200),
      //   allowNull: false
      // },
      // 文件地址
      fileURL:{
        type: Sequelize.STRING,
        allowNull: false
      },
      pageURL:{
        type: Sequelize.STRING,
        allowNull: false
      },
      // 是否开源
      isOpened:{
        type: Sequelize.BOOLEAN,
        allowNull: false
      },
      updatedAt:{
        type: Sequelize.DATE,
        allowNull: false
      },
      createdAt:{
        type: Sequelize.DATE,
        allowNull: false
      }
    });
    this.model = super.getModel();
    this.model.sync();
  }
}

module.exports = new works_public();
